package com.jumi.microservice.controller.admin;

import com.jumi.microservice.common.base.BaseController;
import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.dto.admin.AdminSendRequest;
import com.jumi.microservice.dto.admin.UpdateLogisticsNoRequest;
import com.jumi.microservice.dto.wdt.PushOrderRequest;
import com.jumi.microservice.dto.wdt.WdtResultResponse;
import com.jumi.microservice.service.admin.AdminSendService;
import com.jumi.microservice.wdt.WdtService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author by mazhao
 * @Classname AdminSendController
 * @Description TODO
 * @Date 2020/9/25 10:00
 */
@Api(tags = {"后台售后订单相关接口"})
@RestController
@RequestMapping("/logistics")
public class AdminSendController extends BaseController {

    @Resource
    AdminSendService adminSendService;

    @Resource
    private WdtService wdtService;

    @PostMapping("/send")
    @ApiOperation("编辑发货")
    public ResponseResult<Boolean> send(AdminSendRequest request){
        Long uid = getUid();
        String name = getUserName();
        return success(adminSendService.send(request,uid,name));
    }

    @PostMapping("/updateLogisticsNo")
    @ApiOperation("修改运单号")
    public ResponseResult<Boolean> updateLogisticsNo(UpdateLogisticsNoRequest request){
        Long uid = getUid();
        String name = getUserName();
        return success(adminSendService.updateLogisticsNo(request,uid,name));
    }

    @PostMapping("/wdt/push-order")
    @ApiOperation("旺店通一键推单")
    public ResponseResult<WdtResultResponse> pushOrder(PushOrderRequest pushOrderRequest) {
        return success(wdtService.pushOrder(pushOrderRequest));
    }

}
